package br.ita.redecasd.mi.ws;

public class SessionHandlerWSProxy implements br.ita.redecasd.mi.ws.SessionHandlerWS {
  private boolean _useJNDI = true;
  private String _endpoint = null;
  private br.ita.redecasd.mi.ws.SessionHandlerWS __sessionHandlerWS = null;
  
  public SessionHandlerWSProxy() {
    _initSessionHandlerWSProxy();
  }
  
  private void _initSessionHandlerWSProxy() {
  
  if (_useJNDI) {
    try{
      javax.naming.InitialContext ctx = new javax.naming.InitialContext();
      __sessionHandlerWS = ((br.ita.redecasd.mi.ws.SessionHandlerWSService)ctx.lookup("java:comp/env/service/SessionHandlerWSService")).getSessionHandlerWS();
      }
    catch (javax.naming.NamingException namingException) {}
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  if (__sessionHandlerWS == null) {
    try{
      __sessionHandlerWS = (new br.ita.redecasd.mi.ws.SessionHandlerWSServiceLocator()).getSessionHandlerWS();
      }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  if (__sessionHandlerWS != null) {
    if (_endpoint != null)
      ((javax.xml.rpc.Stub)__sessionHandlerWS)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    else
      _endpoint = (String)((javax.xml.rpc.Stub)__sessionHandlerWS)._getProperty("javax.xml.rpc.service.endpoint.address");
  }
  
}


public void useJNDI(boolean useJNDI) {
  _useJNDI = useJNDI;
  __sessionHandlerWS = null;
  
}

public String getEndpoint() {
  return _endpoint;
}

public void setEndpoint(String endpoint) {
  _endpoint = endpoint;
  if (__sessionHandlerWS != null)
    ((javax.xml.rpc.Stub)__sessionHandlerWS)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
  
}

public br.ita.redecasd.mi.ws.SessionHandlerWS getSessionHandlerWS() {
  if (__sessionHandlerWS == null)
    _initSessionHandlerWSProxy();
  return __sessionHandlerWS;
}

public java.lang.String[] getPatientDetails(java.lang.String login) throws java.rmi.RemoteException{
  if (__sessionHandlerWS == null)
    _initSessionHandlerWSProxy();
  return __sessionHandlerWS.getPatientDetails(login);
}

public java.lang.String validateSign(java.lang.String username, java.lang.String userAgent, byte[] signature) throws java.rmi.RemoteException{
  if (__sessionHandlerWS == null)
    _initSessionHandlerWSProxy();
  return __sessionHandlerWS.validateSign(username, userAgent, signature);
}

public boolean mustAuthenticate(java.lang.String medLogin, java.lang.String patientLogin) throws java.rmi.RemoteException{
  if (__sessionHandlerWS == null)
    _initSessionHandlerWSProxy();
  return __sessionHandlerWS.mustAuthenticate(medLogin, patientLogin);
}

public boolean validateSession(java.lang.String userAgent, java.lang.String username) throws java.rmi.RemoteException{
  if (__sessionHandlerWS == null)
    _initSessionHandlerWSProxy();
  return __sessionHandlerWS.validateSession(userAgent, username);
}

public void updateACL(java.lang.String medLogin, java.lang.String patientLogin) throws java.rmi.RemoteException{
  if (__sessionHandlerWS == null)
    _initSessionHandlerWSProxy();
  __sessionHandlerWS.updateACL(medLogin, patientLogin);
}


}